/*
 * This file is part of ddesktop: remote desktop system for iPad 
 *
 * Copyright (C) 2010 Kazuhiro Satoh
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. if not, see <http://www.gnu.org/licenses/>.
 */


#pragma once
#pragma unmanaged

#include <windows.h>


namespace DDesktopServer
{
	class DesktopCapture
	{
	private:
		HBITMAP m_capture_bmp;
		HBITMAP m_capture_bmp_old;
		LPVOID m_capture_bmp_address;
		HDC m_capture_bmp_dc;
		HDC m_desktop_dc;
		int m_canvas_width, m_canvas_height;
		int m_capture_bmp_width, m_capture_bmp_height;
		int m_capture_bmp_x, m_capture_bmp_y;
		int m_bytes_per_pixel;

	public:
		DesktopCapture(void);
		~DesktopCapture();

		bool Init(int canvas_width, int canvas_height);
		bool Capture(int x, int y, int width, int height);
		HBITMAP GetCaptureBmp(void) const;
		HDC GetCaptureBmpDC(void) const;
		LPVOID GetCaptureBmpAddress(void);
		int GetCaptureBmpSize(void) const;
		int GetCaptureBmpWidth(void) const;
		int GetCaptureBmpHeight(void) const;
		int GetCaptureBmpX(void) const;
		int GetCaptureBmpY(void) const;
		int GetCanvasWidth(void) const;
		int GetCanvasHeight(void) const;
	};
}


#pragma managed

